feat(vendor): add llama.cpp vendor plugin#2131
Open
xb17 wants to merge 1 commit into
Open
Conversation
Adds a dedicated vendor plugin for llama.cpp server (https://github.com/ggml-org/llama.cpp). llama.cpp exposes an OpenAI-compatible REST API but has behaviour that differs from the generic openai_compatible driver: - Default base URL: http://localhost:8080/v1 (llama.cpp default port) - No API key required (auth header is sent only when a key is configured) - Supports cache_prompt to reuse the KV cache across requests that share a common prefix (e.g. the same system prompt), reducing latency - Does not use LM Studio-specific extensions (chat_template_kwargs, etc.) The driver follows the same hand-rolled HTTP pattern as the LM Studio plugin and implements ListModels, SendStream, and Send. Closes danielmiessler#2072
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a dedicated vendor plugin for llama.cpp server.
Background
Issue #2072 requested llama.cpp support. Currently users have to route through the
openai_compatibledriver pointed athttp://localhost:8080/v1, which works but requires manual setup and doesn't expose llama.cpp-specific behaviour.Why a dedicated driver
llama.cpp's server is OpenAI-compatible but differs in a few meaningful ways:
openai_compatiblellama.cpphttp://localhost:8080/v1cache_promptThe
cache_prompt: truefield is particularly valuable for Fabric usage patterns, where the same system prompt (pattern) is sent repeatedly across requests. llama.cpp reuses the KV cache for the matching prefix, significantly reducing time-to-first-token on subsequent requests.Implementation
Follows the same hand-rolled HTTP approach as the LM Studio plugin. Implements
ListModels,SendStream, andSend. API key is optional — the Authorization header is only set when a key is configured.New files:
internal/plugins/ai/llamacpp/llamacpp.gointernal/i18n/locales/en.jsoninternal/core/plugin_registry.goCloses #2072